package demo1;

import java.util.Arrays;

public class Text {

    public static void main(String[] args)  throws CloneNotSupportedException{
        Student student1 = new Student("zhangsan",18);

        Student student2 = (Student) student1.clone();


        System.out.println(student1);
        System.out.println(student2);

        student2.m.money = 100;

        System.out.println("==============");


        System.out.println(student1);
        System.out.println(student2);


    }
    
    
    public static void mySort(Comparable[] comparables){
        for (int i = 0; i < comparables.length; i++) {
            for (int j = 0; j < comparables.length-1-i; j++) {
                if(comparables[j].compareTo(comparables[j+1]) > 0){
                    Comparable tmp = comparables[j];
                    comparables[j] = comparables[j+1];
                    comparables[j+1] = tmp;
                }
            }
        }
    }
    

    public static void print1(Student[] students){
        for(Student student : students){
            System.out.print(student.toString());
        }
    }


    public static void main1(String[] args) throws CloneNotSupportedException {
        Student student1 = new Student("zhangsan",18);
        Student student2 = new Student("lisi",10);


        AgeComparator ageComparator = new AgeComparator();

//        System.out.println(ageComparator.compare(student1,student2));


//        Student student3 = new Student("wangwu",30);
//        Student student4 = (Student)student1.clone();
//
        Student[] students = new Student[3];
        students[0] = new Student("zhangsan",18);
        students[1] = new Student("lisi",10);
        students[2] = new Student("wangwu",30);

        Arrays.sort(students,ageComparator);

//        print1(students);

        System.out.println(students);
//
//        System.out.println(student4);

//        System.out.println(student1.compareTo(student3));
    }
}
